<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
	
    </head>
    <body>
        <a href="javascript:WebSocketTest()">Run WebSocket</a>
        <div id="messages" style="height:200px;background:black;color:white;"></div>
    </body>
	
    <script type="text/javascript">
        var messageContainer = document.getElementById("messages");
        function WebSocketTest() {
            if ("WebSocket" in window) {
                messageContainer.innerHTML = "WebSocket is supported by your Browser!";
                var ws = new WebSocket("ws://localhost:8888/websocket?Id=12345");
                ws.onopen = function() {
                    ws.send("Message to send");
                };
                ws.onmessage = function (evt) { 
                    var received_msg = evt.data;
                    messageContainer.innerHTML =
     			  messageContainer.innerHTML+
  				  "<br/>Message is received:"+received_msg;
                };
                ws.onclose = function() { 
                    messageContainer.innerHTML =
  				  messageContainer.innerHTML+"<br/>Connection is closed...";
                };
            } else {
                messageContainer.innerHTML = "WebSocket NOT supported by your Browser!";
            }
        }
    </script>
</html>
